<template>
  <div>
 <!-- 顶部导航栏 --> 
    <van-nav-bar  :title="header" left-arrow @click-left="$router.go(-1)" />
    <van-list v-model="loading" :finished="finished" finished-text="没有更多了"   @load="onLoad">  <!-- @load="onLoad" -->
      <van-cell v-for="item in informList" :key="item.id" @click="onNotice(item.id)">
        <van-cell class="matters" :title="item.title" is-link  ></van-cell>
        <p class="dataName">{{item.updateDate}}</p>
      </van-cell>
    </van-list>
  </div>
</template>
<script>
import apiHttp from '../../../../../api/index'
export default {
  data() {
      return {
        id:this.$route.query.id ? this.$route.query.id : '',  // 判断页面是否存在id
        header: "通知",
        finished: false,
        loading: false,
        informList:[],
        total:-1,
        page:0,
      }
    },
    
    methods:{
  
      onNotice(id){
        this.$router.push({path:"./partyNotice",query: { id: id}});
      },
    // 新闻列表---接口
    getInformList(){
      let params ={
        page : this.page,
        pageSize :10,
        commId:this.id
      }
      apiHttp.comIndex.getInformList(params,resp=>{
        if(resp.resultCode == '000000'){
          for(let i = 0; i < resp.data.informList.length; i++){
            this.informList.push(resp.data.informList[i])
          }
          this.total = resp.data.total
          this.loading = false;
        }else{
          Toast(resp.resultMsg)
        }
      })
    },
    onLoad(){
      if(this.informList.length == this.total){
        this.finished  = true
        this.loading = false;
      }else{
        this.page++
        this.getInformList();
      }
    }
  }
}
</script>
<style scoped>
  @import '../../../../../assets/css/community/listIntroduction/guide.css'; 
  .van-cell::after {
    content: ' ';
    position: absolute;
    pointer-events: none;
    box-sizing: border-box;
    left: 15px;
    right: 0;
    bottom: 0;
    -webkit-transform: scaleY(.5);
    transform: scaleY(.5);
    border-bottom: 0px solid #ebedf0;
  }
  .van-cell{
    margin-bottom: 0;
    
  }
  .dataName{
    color: #999999;
    font-size: .4rem;
    width: 92%;
    margin: 0.2rem auto;
  }
  .van-cell__title{
    overflow: hidden;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    line-height: .8rem;
    height: 1rem;
  }
</style>